package listener;

import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
import java.io.InputStream;

@WebListener
public class StartTomcatListener implements ServletContextListener {
    public static SqlSessionFactory ssf;
    @Override
    public void contextInitialized(ServletContextEvent sce) {
        InputStream in = StartTomcatListener.class.getClassLoader().getResourceAsStream("config.xml");
        ssf = new SqlSessionFactoryBuilder().build(in);
    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {

    }
}
